/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package muddb.entities;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Embeddable;


/**
 *
 * @author keith
 */
@Embeddable
public class UserCharItemPK implements Serializable {
  @Column( name = "char_id", nullable = false )
  private int charId;
  @Column( name = "item_class_id", nullable = false )
  private int itemClassId;
  @Column( name = "item_id", nullable = false )
  private int itemId;
  @Column( name = "user_id", nullable = false )
  private int userId;


  public UserCharItemPK() {
  }


  public UserCharItemPK( int userId, int charId, int itemClassId, int itemId  ) {
    this.userId = userId;
    this.charId = charId;
    this.itemClassId = itemClassId;
    this.itemId = itemId;
  }


  public int getUserId() {
    return userId;
  }


  public void setUserId( int userId ) {
    this.userId = userId;
  }


  public int getCharId() {
    return charId;
  }


  public void setCharId( int charId ) {
    this.charId = charId;
  }


  public int getItemClassId() {
    return itemClassId;
  }


  public void setItemClassId( int itemClassId ) {
    this.itemClassId = itemClassId;
  }


  public int getItemId() {
    return itemId;
  }


  public void setItemId( int itemId ) {
    this.itemId = itemId;
  }


  @Override
  public int hashCode() {
    int hash = 0;
    hash += (int) charId;
    hash += (int) itemClassId;
    hash += (int) itemId;
    hash += (int) userId;
    return hash;
  }


  @Override
  public boolean equals( Object object ) {
    // TODO: Warning - this method won't work in the case the id fields are not set
    if ( !( object instanceof UserCharItemPK ) ) {
      return false;
    }
    UserCharItemPK other = (UserCharItemPK) object;
    if ( this.charId != other.charId ) {
      return false;
    }
    if ( this.itemClassId != other.itemClassId ) {
      return false;
    }
    if ( this.itemId != other.itemId ) {
      return false;
    }
    if ( this.userId != other.userId ) {
      return false;
    }
    return true;
  }


  @Override
  public String toString() {
    return "muddb.entities.UserCharItemPK[userId=" + userId + ", charId=" + charId + ", itemClassId=" + itemClassId + ", itemId=" + itemId + "]";
  }

}
